package com.itheima.d6_lambda;

/**
 * Lambda表达式 用于函数式接口
 */
public class LambdaDemo1 {
    public static void main(String[] args) {
        //不是函数式接口 不能用lambda表达式
        A a1 = new A() {
            @Override
            public void show() {
                System.out.println("抽象方法的匿名内部类");
            }
        };

        Swim s = new Swim() {
            @Override
            public void swimming() {
                System.out.println("函数式接口的匿名内部类1");
            }
        };

        Swim s1 = () -> {
                System.out.println("函数式接口的匿名内部类2");
        };


    }
}
@FunctionalInterface
interface Swim{
    void swimming();
}


abstract class A{
    abstract void show();
}
